<!DOCTYPE html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo,Gitee,Github,">










<meta name="description" content="前提：搭建一个个人的搭建博客。 需求分析：由于本人的经济状况，所以这里就没有Q去购买一个云服务，然后通过百度找到使用Hexo+Github可以搭建一个免费的个人博客。然后考虑Github平时下载和上传的速度，决定使用比较靠谱的Gitee，毕竟到时候Github被墙了还能补救嘛~ 环境背景：Hexo: 是一款基于Node.js用于快速搭建博客的框架，它会帮你构建整个博客的整个框架，你只需要会使用Ma">
<meta name="keywords" content="Hexo,Gitee,Github">
<meta property="og:type" content="article">
<meta property="og:title" content="Hexo+Gitee搭建博客">
<meta property="og:url" content="https://gitee.com/blghost/blog.git/2019/09/04/Hexo+Gitee搭建博客/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="前提：搭建一个个人的搭建博客。 需求分析：由于本人的经济状况，所以这里就没有Q去购买一个云服务，然后通过百度找到使用Hexo+Github可以搭建一个免费的个人博客。然后考虑Github平时下载和上传的速度，决定使用比较靠谱的Gitee，毕竟到时候Github被墙了还能补救嘛~ 环境背景：Hexo: 是一款基于Node.js用于快速搭建博客的框架，它会帮你构建整个博客的整个框架，你只需要会使用Ma">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://i.loli.net/2019/09/10/7f1eWBu8zVvHX2n.png">
<meta property="og:image" content="https://i.loli.net/2019/09/10/dt1iDNlpxfSzJOb.png">
<meta property="og:image" content="https://i.loli.net/2019/09/10/6rQH7xzEFKftnIc.png">
<meta property="og:image" content="https://i.loli.net/2019/09/10/H6Jg4F89lOI3uSm.png">
<meta property="og:image" content="https://i.loli.net/2019/09/10/J7ebxF2E34fQCNX.png">
<meta property="og:image" content="https://i.loli.net/2019/09/10/BDmTg19oSItlNdM.png">
<meta property="og:image" content="https://i.loli.net/2019/09/10/pVAK2r47jfS1cNk.png">
<meta property="og:updated_time" content="2019-09-10T12:13:02.146Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Hexo+Gitee搭建博客">
<meta name="twitter:description" content="前提：搭建一个个人的搭建博客。 需求分析：由于本人的经济状况，所以这里就没有Q去购买一个云服务，然后通过百度找到使用Hexo+Github可以搭建一个免费的个人博客。然后考虑Github平时下载和上传的速度，决定使用比较靠谱的Gitee，毕竟到时候Github被墙了还能补救嘛~ 环境背景：Hexo: 是一款基于Node.js用于快速搭建博客的框架，它会帮你构建整个博客的整个框架，你只需要会使用Ma">
<meta name="twitter:image" content="https://i.loli.net/2019/09/10/7f1eWBu8zVvHX2n.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Muse',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://gitee.com/blghost/blog.git/2019/09/04/Hexo+Gitee搭建博客/">





  <title>Hexo+Gitee搭建博客 | Hexo</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Hexo</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://gitee.com/blghost/blog.git/blog/2019/09/04/Hexo+Gitee搭建博客/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Blackghost">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/blog/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Hexo">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Hexo+Gitee搭建博客</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-09-04T18:20:00+08:00">
                2019-09-04
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="前提："><a href="#前提：" class="headerlink" title="前提："></a>前提：</h2><p>搭建一个个人的搭建博客。</p>
<h2 id="需求分析："><a href="#需求分析：" class="headerlink" title="需求分析："></a>需求分析：</h2><p>由于本人的经济状况，所以这里就没有Q去购买一个云服务，然后通过百度找到使用Hexo+Github可以搭建一个免费的个人博客。然后考虑Github平时下载和上传的速度，决定使用比较靠谱的Gitee，毕竟到时候Github被墙了还能补救嘛~</p>
<h2 id="环境背景："><a href="#环境背景：" class="headerlink" title="环境背景："></a>环境背景：</h2><p><strong>Hexo:</strong> 是一款基于Node.js用于快速搭建博客的框架，它会帮你构建整个博客的整个框架，你只需要会使用Markdown写博客即可。</p>
<p><strong>Gitee:</strong>码云(<em>gitee</em>.com)是 OSCHINA.NET 推出的代码托管平台,支持 Git 和 SVN,提供免费的私有仓库托管。</p>
<h2 id="环境搭建："><a href="#环境搭建：" class="headerlink" title="环境搭建："></a>环境搭建：</h2><p>目标环境：win7+Node.js+Hexo+Git</p>
<p>Node.js: <a href="http://nodejs.cn/download/" target="_blank" rel="noopener">http://nodejs.cn/download/</a></p>
<p>下载并安装。</p>
<p>查看是否安装成功</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm --version</span><br></pre></td></tr></table></figure>

<p>安装<strong>Hexo</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-cli -g</span><br></pre></td></tr></table></figure>

<p>如果出现以下问题：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted &#123;&quot;os&quot;:&quot;darwin&quot;,&quot;arch&quot;:&quot;any&quot;&#125; (current: &#123;&quot;os&quot;:&quot;win32&quot;,&quot;arch&quot;:&quot;x64&quot;&#125;)</span><br></pre></td></tr></table></figure>

<p><strong>可以直接忽略，系统会自动安装</strong></p>
<p>查看Hexo是否安装成功</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo --version</span><br></pre></td></tr></table></figure>

<p>Git: <a href="https://pc.qq.com/detail/13/detail_22693.html" target="_blank" rel="noopener">https://pc.qq.com/detail/13/detail_22693.html</a></p>
<p>下载并安装。</p>
<p>成功后会在鼠标-&gt;右键多了Git两项的选项</p>
<h2 id="搭建博客"><a href="#搭建博客" class="headerlink" title="搭建博客:"></a>搭建博客:</h2><p>1、在你的电脑上创建<strong>BLOG</strong>文件夹，在BLOG文件夹右键<strong>GIT Bash Here</strong>，输入命令</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo init</span><br></pre></td></tr></table></figure>

<p>2、然后再输入命令克隆hexo主题：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git clone https://github.com/theme-next/hexo-theme-next</span><br></pre></td></tr></table></figure>

<p><a href="https://hexo.io/themes/" target="_blank" rel="noopener">查看更多主题</a></p>
<p>3、_config.yml对博客进行基础配置</p>
<p><img src="https://i.loli.net/2019/09/10/7f1eWBu8zVvHX2n.png" alt="1567591218342.png"></p>
<p><img src="https://i.loli.net/2019/09/10/dt1iDNlpxfSzJOb.png" alt="1567591379568.png"></p>
<p>title：标题</p>
<p>author: 用户名</p>
<p>language: 语言</p>
<p>theme: 主题包的名称</p>
<p>修改完后保存，<strong>注意：每个属性后面都要有个空格</strong></p>
<p>4、本地预览博客</p>
<p>编译项目：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo g</span><br></pre></td></tr></table></figure>

<p>运行项目：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo s</span><br></pre></td></tr></table></figure>

<p>然后在浏览器访问：localhost:4000 就可以看到最终效果了</p>
<h2 id="部署博客到Gitee上"><a href="#部署博客到Gitee上" class="headerlink" title="部署博客到Gitee上:"></a>部署博客到Gitee上:</h2><p>1、在博客中新建仓库，仓库名为blog(自定义)；然后选择公开</p>
<p><img src="https://i.loli.net/2019/09/10/6rQH7xzEFKftnIc.png" alt="1567591722585.png"></p>
<p>2、配置下_config.yml中Git</p>
<p><img src="https://i.loli.net/2019/09/10/H6Jg4F89lOI3uSm.png" alt="1567591810774.png"></p>
<p>3、发布到Gitee</p>
<p>输入命令：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>

<p>安装自动部署发布工具，然后再输入命令：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo clean &amp;&amp; hexo g &amp;&amp; hexo d</span><br></pre></td></tr></table></figure>

<p>发布博客，首次发布需要在shell中输入账号和密码</p>
<p>4、Gitee Page设置</p>
<p>在仓库，服务中的Gitee Page（需要绑定手机才能开启），然后更新页面</p>
<p><img src="https://i.loli.net/2019/09/10/J7ebxF2E34fQCNX.png" alt="1567591952538.png"></p>
<p><img src="https://i.loli.net/2019/09/10/BDmTg19oSItlNdM.png" alt="1567591993210.png"></p>
<h2 id="写博客"><a href="#写博客" class="headerlink" title="写博客:"></a>写博客:</h2><p>1、创建一个新的页面：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo new 文章名</span><br></pre></td></tr></table></figure>

<p>2、写完博文后，生成网页文件：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo g</span><br></pre></td></tr></table></figure>

<p>3、发布到Gitee上</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo d</span><br></pre></td></tr></table></figure>

<p><img src="https://i.loli.net/2019/09/10/pVAK2r47jfS1cNk.png" alt="1567592398703.png"></p>
<p>这里是博客地址</p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/blog/tags/Hexo/" rel="tag"># Hexo</a>
          
            <a href="/blog/tags/Gitee/" rel="tag"># Gitee</a>
          
            <a href="/blog/tags/Github/" rel="tag"># Github</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/2019/09/02/hello-world/" rel="next" title="Hello World">
                <i class="fa fa-chevron-left"></i> Hello World
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2019/09/04/环境搭建/" rel="prev" title="成长日记第一篇">
                成长日记第一篇 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">Blackghost</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/blog/archives/">
              
                  <span class="site-state-item-count">6</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            

            
              
              
              <div class="site-state-item site-state-tags">
                
                  <span class="site-state-item-count">15</span>
                  <span class="site-state-item-name">标签</span>
                
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#前提："><span class="nav-number">1.</span> <span class="nav-text">前提：</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#需求分析："><span class="nav-number">2.</span> <span class="nav-text">需求分析：</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#环境背景："><span class="nav-number">3.</span> <span class="nav-text">环境背景：</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#环境搭建："><span class="nav-number">4.</span> <span class="nav-text">环境搭建：</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#搭建博客"><span class="nav-number">5.</span> <span class="nav-text">搭建博客:</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#部署博客到Gitee上"><span class="nav-number">6.</span> <span class="nav-text">部署博客到Gitee上:</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#写博客"><span class="nav-number">7.</span> <span class="nav-text">写博客:</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Blackghost</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Muse</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
